<template>
    <div>
        <el-dialog v-model="showDialog" title="支付宝账户体现" width="515">
            <div class="flex items-center">
                <div class="mr-20px flex-shrink-0">提现金额</div>
                <el-input v-model="amount" placeholder="请输入提现金额" type="number"/>
            </div>
            <div class="flexcenterbox" style="margin-top: 40px">
                <el-button class="my_cancelbtn" @click="onCancel">取消</el-button>
                <el-button class="my_btn" @click="onConfirm">确定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script lang="ts" setup>
import {ref, watch} from 'vue'
import {alipayWithdraw} from '@/api/approval/upload'
import {
    ElMessage,
} from 'element-plus'

import {
    longdispatchingagencycheckapi,
} from '@/api/api'

const props = defineProps({
    show: {
        type: Boolean,
        default: false
    },
    companyId: {
        type: Number,
        required: true
    }
})

const emits = defineEmits(['update:show', 'success'])

const showDialog = ref(false)
const amount = ref()

const onCancel = () => {
    showDialog.value = false
}

const onConfirm = async () => {
    if (!amount.value) {
        ElMessage.error('请输入提现金额')
        return
    }
    console.log(11111, amount.value, props.companyId)
    await alipayWithdraw({
        amount: amount.value,
        companyId: props.companyId
    })
    showDialog.value = false
    emits('success')
}

watch(() => props.show, (newval) => {
    showDialog.value = newval
})

watch(showDialog, (newval) => {
    emits('update:show', newval)
})
</script>
<style lang="scss" scoped></style>
